<?php

class VerifaceRuleModel extends BaseModel
{
    protected $table = 'veriface_rule';

    public static function isUnCertain($score)
    {
        return self::getAuthStatus($score) == 2;
    }

    public static function getAuthStatus($score)
    {
        $ruleResult = \VerifaceRuleModel::query()->orderBy('max_score', 'asc')->get();
        foreach ($ruleResult as $rule) {
            if ($score <= $rule['max_score']) {
                return $rule['auth_result'];
            }
        }

        return 0;
    }
}